var app = getApp();
// pages/order/detail.js
Page({
  data:{
    orderId:0,
    orderData:{},
    proData: [],
    goodsurl: app.d.hostUrl + app.d.goodsurl,
  },
  onLoad:function(options){
    this.setData({
      orderId: options.orderId,
    })
    this.loadProductDetail();
  },
  loadProductDetail:function(){
    var that = this;
    wx.request({
      url: app.d.hostUrl + 'wapi/order_details.html',
      method:'post',
      data: {
        order_id: that.data.orderId,
        seesionid: app.globalData.userInfo.sessionId,
        openid: app.globalData.userInfo.openid,
      },
      header: {
        'Content-Type':  'application/x-www-form-urlencoded'
      },
      success: function (res) {
        var status = res.data.ret;
        if(status == 0){
          //var pro = res.data.pro;
          var ord = res.data.data;
          that.setData({
            orderData: ord,
            //proData:pro
          });
        }else{
          wx.showToast({
            title: res.data.msg,
            duration: 2000
          });
        }
      },
      fail: function () {
          // fail
          wx.showToast({
            title: '网络异常！',
            duration: 2000
          });
      }
    });
  },
  onShareAppMessage: function () {
    return {
      title: '赚钱那些事儿',
      path: '/pages/index/index?scene=invite%3D' + app.globalData.user_id,
      success: function (res) {
        wx.showToast({
          title: '分享成功',
          duration: 2000
        });
      },
      fail: function (res) {
        // 分享失败
      }
    }
  },
})